const Router = require('koa-router');
const {verifyAuth} = require('../middleware/auth.middleware');
const {isExistMusic} = require('../middleware/exist.middleware');
const {create, remove, update, getMusicById, list} = require('../controller/music.controller');

const musicRouter = new Router({prefix: "/music"});

// 创建一个音乐
musicRouter.post("/", verifyAuth, isExistMusic, create);
// 删除一个音乐
musicRouter.delete("/", verifyAuth, remove);
// 修改一个音乐
musicRouter.patch("/", verifyAuth, update);
// 获取音乐详情
musicRouter.get("/", verifyAuth, getMusicById);
// 查询音乐列表
musicRouter.get("/list", list);

module.exports = musicRouter;
